fix: OpenCode array item schemas#180
Conversation
|
Warning Review limit reached
Next review available in: 34 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughFixes ChangesArray items schema preservation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/opencode/src/schema.ts`:
- Around line 94-100: The array-item fallback in jsonSchemaPropertyToOpenCode
still allows unsupported non-empty items schemas to recurse into
tool.schema.unknown(), which should be treated as unusable. Update the
itemSchema logic so that after calling
jsonSchemaPropertyToOpenCode(schema.items, { optional: false }), you detect an
unknown() result and fall back to tool.schema.string() instead. Keep the
existing handling in schema.ts for missing, empty, or non-object items, and
apply the same fallback behavior for any unsupported items schema that resolves
to unknown.
- Around line 70-72: The enum handling in schema conversion is missing optional
wrapping, so enum properties are still treated as required. Update the enum
branch in schema.ts where tool.schema.enum(...) is returned so it follows the
same optionality behavior as the other top-level property branches, and make
sure the change is applied in the schema conversion path that handles enum
arrays. Add a regression test covering enum inputs to verify the resulting
schema remains optional.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: df6b175e-c3e0-4233-9f5c-e2a3aefd4154
📒 Files selected for processing (3)
.changeset/sharp-array-schemas.mdpackages/opencode/src/schema.tspackages/opencode/test/opencode.test.ts
Summary
itemsdefinitions when@caplets/opencoderegisters direct native tool schemas.itemsobject, avoiding empty Gemini array item declarations.array<string>direct native input schemas and a patch changeset for@caplets/opencode.Validation
pnpm --filter @caplets/opencode test -- test/opencode.test.tspnpm --filter @caplets/opencode typecheckpnpm --filter @caplets/opencode buildpnpm format:checkpnpm changeset status --since=origin/mainpnpm verifypnpm verifyFixes #178
Summary by CodeRabbit